<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

/**
 * Class MarketList
 * @package App
 */
class MarketList extends Model
{
    public $timestamps = false;
    protected $table = "market_list";

    /**
     * 添加
     * @param $request
     * @return array
     */
    static function MarketPublish($request)
    {
        $market = new MarketList();
        $market->title = $request->title;
        $market->mobile = $request->mobile;
        $market->remarks = $request->remarks;

        if (!$market->save()) {
            return ['status' => 2, 'message' => '失败'];
        }
        return ['status' => 1, 'message' => '成功'];
    }

    /**
     * 修改
     * @param $market
     * @param $request
     * @return array
     */
    static function MarketModify($market, $request)
    {
        $market->title = $request->title;
        $market->mobile = $request->mobile;
        $market->remarks = $request->remarks;
        if (!$market->save()) {
            return ['status' => 2, 'message' => '失败'];
        }
        return ['status' => 1, 'message' => '成功'];
    }
}
